//
//  FootprintViewController.m
//  ZhiHuiLiJiang
//
//  Created by Work on 2018/11/18.
//  Copyright © 2018年 王雅鹏. All rights reserved.
//我的足迹VC--已废弃

#import "FootprintViewController.h"
#import "NavigationView.h"
#import "FootprintCell.h"

@interface FootprintViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (nonatomic ,strong) UITableView * mainTableView;

@end
@implementation FootprintViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    [self addSubViewClick];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    if (!self.tabBarController.tabBar.isHidden) {
        self.tabBarController.tabBar.hidden = YES;
    }
}
- (void)setupUI{
    self.view.backgroundColor = [UIColor whiteColor];
    BY_kWeakSelf(ws);
    [self setTitleStr:@"我的足迹" leftAction:^{
        [ws.navigationController popViewControllerAnimated:YES];
    }];
    
    //tableView
    _mainTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64, KSCREEWIDTH, KSCREEHEGIHT  -64) style:UITableViewStyleGrouped];
    _mainTableView.delegate = self;
    _mainTableView.dataSource = self;
    _mainTableView.backgroundColor = [UIColor whiteColor];
    _mainTableView.separatorStyle =NO;
    _mainTableView.tableFooterView = [UIView new];
    _mainTableView.sectionFooterHeight = 0.1;
    _mainTableView.rowHeight = BY_Width(118) + BY_Height(28);
    _mainTableView.sectionHeaderHeight = BY_Width(38) + BY_Height(32*2);
    [_mainTableView registerClass:[FootprintCell class] forCellReuseIdentifier:@"FootprintCell"];
    
    [self.view addSubview:self.mainTableView];
}
- (void)addSubViewClick{
//        BY_kWeakSelf(ws);
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    NSLog(@"内存警告");
}

#pragma mark- tableView代理
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 3;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    FootprintCell  *cell = [tableView dequeueReusableCellWithIdentifier:@"FootprintCell" forIndexPath:indexPath];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.HimageView.image = [UIImage imageNamed:@"mineIcon_footCellIcon"];
//    cell.backgroundColor = BYRandomColor;
    cell.timeLabel.text =@"2018-11-21";
    cell.contentLabel.text =@"丽江古城位于云南省丽江市古城区，又名大研古城……";
    cell.numLabel.text =@"32评";
    cell.conteryLabel.text =@"丽江日报";
    [cell add:@"1"];
    return cell;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    UIView *headView = [[UIView alloc]init];
    headView.backgroundColor = [UIColor whiteColor];
    UIView *lineView = [BYVS createViewBGColor:BYColor6 addSubView:headView];
    UIImageView *titleImgView = [BYVS createImgView:@"mineIcon_footArrow" addSubView:headView];
    UILabel *titleLab = [BYVS createLabText:((section == 0) ? @"今天" : @"更早") font:BYPTFont26 labColor:BYColor9 addSubView:titleImgView];
    [titleImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.offset(BY_Width(84));
        make.height.offset(BY_Width(38));
        make.left.equalTo(headView.mas_left).offset(BY_Width(24));
        make.top.equalTo(headView.mas_top).offset(BY_Height(32));
    }];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.height.offset(BY_Height(2));
        make.right.equalTo(headView.mas_right).offset(BY_Width(-24));
        make.left.equalTo(titleImgView.mas_right);
        make.centerY.equalTo(titleImgView.mas_centerY);
    }];
    [titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(titleImgView.mas_centerY);
        make.centerX.equalTo(titleImgView.mas_centerX).offset(BY_Width(-5));
    }];
    
    return headView;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    NSLog(@"点击了我的足迹的cell");

}


@end
